package com.xunji.user.util;

import cn.hutool.core.codec.Base64;
import org.apache.commons.lang3.StringUtils;

public class Base64Util {

    public static String encode(String str){
        if(StringUtils.isEmpty(str)){
            return "";
        }
        return Base64.encode(str);
    }

    public static String decode(String str){
        if(StringUtils.isEmpty(str)){
            return "";
        }
        return Base64.decodeStr(str);
    }

    public static void main(String[] args) {
        System.out.println(encode("ABCxyz123"));
        System.out.println(decode("NjY2NjY2"));
    }

}
